import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainClass
{

public static void doHomework(Learnable learnable)
{
    learnable.read();
}

    public static void main(String[] args) {
        //创建容器
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        //从容器中获取你要的类的实例
        Learnable learnable = (Learnable) ctx.getBean("teacher");
        //执行功能
        learnable.read();
        learnable = (Learnable) ctx.getBean("student");
        //执行功能
        learnable.read();
    }
}
